// pages/lifeservice/lifeservice.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    category:[],
    activeId: 0,//被激活那项的索引

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
      this.getCategoryList()
  },
  updateActive(e){
  const {index}=e.currentTarget.dataset
  // console.log(index)
  this.setData(
    {
      activeId:index
    }
  )
  console.log(this.data.activeId)
  },
  getCategoryList(){
    console.log("------------")
    this.setData({
      category:[{
        id:1,
        categoryname: '助餐',
        children:[
          {
            title:"上门做饭",
            content:"上门做饭",
            price:"￥20/次"
          },
          {
            title:"上门送饭",
            content:"上门做饭",
            price:"￥20/次"
          },
        ]
    },
  
    {
      id:2,
      categoryname: '助行',
      children:[
        {
          title:"助行",
          content:"助行",
          price:"￥20/次"
        }
      ]
    },
    {
      id:3,
      categoryname: '维修',
      children:[
        {
          title:"维修",
          content:"维修",
          price:"￥20/次"
        }
      ]
    },
    {
      id:4,
      categoryname: '护老保姆',
      children:[
        {
          title:"护老保姆",
          content:"护老保姆",
          price:"￥20/次"
        }
      ]
    },
    {
      id:5,
      categoryname: '居家康复',
      children:[
        {
          title:"居家康复",
          content:"居家康复",
          price:"￥20/次"
        }
      ]
    },
    {
      id:6,
      categoryname: '居家保洁',
      children:[
        {
          title:"居家保洁",
          content:"居家保洁",
          price:"￥20/次"
        }
      ]
    },
    {
      id:7,
      categoryname: '居家照顾',
      children:[
        {

          title:"居家照顾",
          content:"居家照顾",
          price:"￥20/次"
        }
      ]
    }]
    })
  },
//去详情页
  gotoDetaile(e){
      const index=e.currentTarget.dataset.index
      wx.navigateTo({
        url: '../servicedetile/servicedetile?index='+index,
      })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})